package com.zy.portal.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zy.common.util.JsonUtils;
import com.zy.common.util.TaotaoResult;
import com.zy.pojo.TbOrder;
import com.zy.portal.pojo.Item;
import com.zy.portal.service.OrderService;

@Controller
@RequestMapping("/order")
public class OrderController {

	@Autowired
	private OrderService orderService;
	/*
	 * 结算
	 */
	@RequestMapping("/order-cart")
	public String showOrder(String urls,String nums,Model model) {
		List<Item> jsonToPojo = orderService.showOrder(urls);
		model.addAttribute("cartList", jsonToPojo);
		return "order-cart";
	}
	
	/*
	 * 创建订单
	 */
	@RequestMapping("/create")
	public TaotaoResult createOrder() {
		return TaotaoResult.ok();
	}

	/*
	 * 根据订单id查询订单
	 */
	@RequestMapping("/info/{orderId}")
	public TaotaoResult getOrderInfo(@PathVariable("orderId")Long orderId) {
		return TaotaoResult.ok();
	}
	
	/*
	 * 用户分页查询订单
	 */
	@RequestMapping("/info/list/{userId}/{page}/{count}")
	public TaotaoResult getOrderInfoPage(@PathVariable("userId")Long orderId,@PathVariable("page")Integer page,@PathVariable("count") Integer count) {
		return TaotaoResult.ok();
	}
	
	/*
	 * 修改订单状态
	 */
	@RequestMapping("/changeStatus")
	public TaotaoResult updateOrderStatus(Long orderId) {
		return TaotaoResult.ok();
	}
}